import React, { useEffect, useState } from 'react'

function BasicUsage(props:any){
    const [score, setScore] = useState<number>(1);
    const [date, setDate] = useState<Date>(new Date());
    
    useEffect(()=>{
        var timer = setInterval(()=>{
            setDate(new Date());
        },1000);
        return clearInterval(timer);
    });
var someElement = <div> some element</div>;
var isShow = false;
    return (<>
               <div>{`name: ${props.name}, age ${props.age}`}</div>
                <div>Score: {score}</div>
                <div>Date: {date.toTimeString()}</div>
                <button onClick={()=>{setScore(score+1)}}>Add Score</button>
                {isShow&&someElement}
            </>);
}

export default BasicUsage;